package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118619277";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/SU6CVO7SchrnOHLhENL4sMR31ejRaTnrgVsZRVcuxa2Lz3e8FcqiFMXQouG5SkC9/BAKAAWStQujTPLgNIRpFwmFTQ11/hCk4HgsWI7nX3jGWxYhH1CcL+ef7/q71acQfeLN6H7HBUIuX8QPsLTnQs53LjQ4LTQO6+BGeo9tL2iSbn8ULA1aSUvRdXb3h1GPseacNudgg/0ePJCfX5G6SN/kDj/RBDsFfMWAq8oY3H3FMpcZf/WiMetU2kD1HRyf3+ZRKXo4oxsBirwqk0TX9lCqK0rubLtPqpRcjcKOvhlP/8YQj0bPTIpix6DT7bHs2daONLWXKJZBeOkIOSM/AgMBAAECggEBAI0snTSzWk8Wx6Q+lQpmUE4ap+WJifqDnquhHIraEi4C1sKIq+W0b4iPrC7/B3ioxH9yuKOowHQ2ChDLibTPDapBxlULORQMHlyRDiAse8tnOsuqDfsEEYo0EM6JXpOia1pQjkNJg8d+qglvxFOQJvNG6voqr3+GXRVmIG/jpFb/jzQb5nJp1VLL3048A57bxSP4B/TW6ER0EvdaH2jOWKBptisoZyIzaI5QD01VwLbrqjyiJfbVQdkAcfvuhlPUi89QTHYmzKMjkqnfoFMAQszhqWOzWRmWahhxCnZIaHVh6vIJS/b617AFKz0cB7oVmkqq6/IlBv06ltjK1pbM5gECgYEA6Hz+SqqiuPYkYrNI3KbksDng5CNfHsDBGUPi8p4J5bWNzA++ZQ/RDv7I8YT5Y2+PQj3mj6CZw2u14tyhEqhENkwPoCNGd6KiiXzXhE6ZgicdaprBwCr77Ev7AXagpbyib/+vpTbpyB1YN3WNvJ6HVd1VF9ZsAPNkZSj4jYYkqLECgYEA0qGdyyiqvSnKX0iKgfP+fcTv2zH35O7gJscOuH7u254Uzsk50xO2CWGbiU48s1FrNF8Bqa3vzd8UEUvC8y2gP3q0RBzZFllztUTAX/xSZOA/KfLOavA9uYK82pY5KmHDFIC610IcUFDA8h7lsJqG2up75yCz0zLfxvf5SiOjhu8CgYB+GN1r7iUYIRkXF5rbYwICu0HJO44qBe42H+YGJcXEe7aPCbMA6ZVAhtzCcpc5YZbYHO7i0/7SSad7hqMulWl58cM/3iIoXWO/IqFaN693MnP4EDwqWKYPQh7AanEzs55/FLVV7PTb/16LpgzcUzegUM4IgdpOobTAUXqOeEWF4QKBgFd1G9vbSum4jHr71+cVtLnsJ9vP56p7NT9kr8wTiIJQJTunegcWzCMhED/26GVcjTL1r+8Qdd35no9/8bafX0Z8YJVXlRwekFjX7zjrwBp6sj9sviDRGBALJPduINZkOWgt+2ad4LvIjBT8l0q5Hv2PF1tkzMYI/bnUBQKvwZqpAoGAe2JwrmaYyIFq5E1PGwAVRnJr3gg06QilK33gNRssfJsZ8k3uvb8vO6bt5h5CQy7CKjJET4vYvMK7cdvNYJkvnlMzGT+iw9HKvscM9G77vNWJTSe6UGlR2oWlmQmHBXixUESovD99eO2L+PuqNuZAa4q2g0YhFatgtzAXfsYSA1Y=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoa9o+egr4Vd3s6jA8wruOcyGIJ5H5ltwLJGCkTfwMTb/8fld0bVU9ihlPUQY9DAhTpVHEles0+2hDt44Mmma/1y/n5QFmcOr/QoSdlOoEXkEQtF/o7qj3nPtaurlN4qLloV5rseJpkNcP5TBYJB44qGpRSN0x6M+Gy1jfUBxTcHsblJC9f8cEh0VJ52lKnV+UguteGCj6naeN1oUaIDeB6fT4bVMPRWbotu1C8kd4wAOiGXoD1ovWnosAqG56P//N8nLVdFpQ7d3n5ypgs5ejp6AifwFw5Qd2d32ANa+jnEpAKvuBMZuV4FSsq4jHB9Y6m1nJzU/8ROgx7gyoHaOeQIDAQAB";
	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

